const Service = require('egg').Service;

class ListService extends Service{
    async add(timer,title,author,important,num,status){
        await this.app.mysql.query('insert into list (timer,title,author,important,num,status) values (?,?,?,?,?,?)',[timer,title,author,important,num,status])
    }
    //修改
    async update(timer,title,author,important,num,status,id){
        await this.app.mysql.query('update list set timer=?,title=?,author=?,important=?,num=?,status=? where id=?',[timer,title,author,important,num,status,id])
    }
    //获取
    async bookslist(start,count){
        // return await this.app.mysql.query(`select * from list limit ${start},${count}`);
        return await this.app.mysql.query(`select * from list`);
    }
    //删除
    async del(id){
        await this.app.mysql.query('delete from list where id=?',[id])
    }
}

module.exports = ListService